package com.jt;

import com.jt.config.SpringConfig;
import com.jt.demo.User;
import org.junit.jupiter.api.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import java.util.Calendar;

public class TsetSpring {

    @Test
    public void testDemo1(){
        ApplicationContext context = new AnnotationConfigApplicationContext(SpringConfig.class);

        User user = context.getBean(User.class);

        user.say();

    }
    @Test
    public void testDemo2(){
        ApplicationContext context = new AnnotationConfigApplicationContext(SpringConfig.class);

        Calendar calendar = context.getBean(Calendar.class);
        //Calendar calendar =(Calendar) context.getBean("calendar111");
        System.out.println("获取当前时间："+calendar.getTime());
        System.out.println("获取年："+calendar.getWeekYear());

    }

}
